<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="${rootPath}/css/a.css" type="text/css" rel="stylesheet" />
<link href="${rootPath}/css/index.css" type="text/css" rel="stylesheet" />
<title>终端序列号撤回查询</title>
<script type="text/javascript"
	src="<s:url value="/js/jquery-1.3.2.js" />"></script>
<script type="text/javascript" src="<s:url value="/js/common.js" />"></script>
<script language="javascript" type="text/javascript"
	src="<s:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
<script type='text/javascript' src='<s:url value="/dwr/engine.js"/>'></script>
<script type='text/javascript' src='<s:url value="/dwr/interface/MccQuery.js"/>'></script>
<script type="text/javascript">
//终端分配撤回
function recall(){
var dd = $("input[name=terList]:checked");
if(dd.length != 1){
	alert("请选择一个代理商进行设置");
	return false;
}
var id = dd.val();	        
$("#queryUserForm").attr("action","termianlAllotRecall.ct?serialNum="+id);
$("#queryUserForm").submit();
}

$(document).ready(function(){

loadBrandCode();

    $("#revokeBtn").click(function(){
       
       var dd = $("input[name=multi_sel_str]:checked");
  	   if(dd.length < 1){
  			alert("请至少选择一个序列号进行撤回");
  			return false;
  	   }
  	  
	   
       $("#queryUserForm").attr("action","${rootPath}/termAllotRecall/termianlAllotRecall.ct");
      
    });	
   
});


//加载终端名称
	function loadBrandCode() {
	
			var sortCode = $("#posBrand").val();
			 var posName = $("#posName").val();
			if (sortCode==null||sortCode=="") {
			//$("#posName").empty().append("<option value=''>不限</option>");
				return;
			}
			
			MccQuery.loadBrandNameById(sortCode, function(sortSmall) {
				fillSelect_sort("posName", sortSmall,posName);
			});
		}
			
	
	function fillSelect_sort(sid, address,choiseId) {
	  	
				if (!address || !sid) {
					return;
				}
				
				var $select = $("#" + sid);
				$select.empty();
				
				$("#" + sid).empty().append("<option value=''>--不限--</option>");
				
				for ( var i = 0; i < address.length; i++) {
					$select.append("<option value='"+address[i].CODE+"'>"
							+ address[i].NAME + "</option>");
				}

				if(choiseId!="" && choiseId!=null){
				 $("#" + sid).val(choiseId);
				}
		}		
</script>
</head>
<body>
<div class="subpage">
		<s:form id="queryUserForm" action="/termAllotRecall/queryTermAllotInfo.ct" method="post"
			  theme="simple">
			  <s:hidden name="posInfo.agentId"></s:hidden>
			<div class="user_title">
				<h2 class="headline-inquires">
					POS收单运营管理平台<br />
				</h2>
			</div>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="query_table">
			     <tr>
					<td colspan="8" align="center">
						<h2 class="headline-inquires">
							可撤回终端序列号查询<br />
							<span class="sub-title"></span>
						</h2>
					</td>
				</tr>
				<tr>
					  	
					   <td align="right" width="15%">品牌：</td>
						<td>
							<s:select cssClass="queryWidth" name="searchCondition.posBrand"
								id="posBrand" onchange="loadBrandCode()"
								list="#request.brandMap" listKey="key" listValue="value" />	
						</td>
						<td align="right" width="15%">机型：</td>
						<td>
							<s:select cssClass="queryWidth" name="searchCondition.posType"
								id="posTypeCode"
								list="#request.typeMap" listKey="key" listValue="value" />
						</td>
						<td align="right" width="15%">名称：</td>
						<td>
							<s:select cssClass="queryWidth" name="searchCondition.posName"
								id="posName"
								list="#request.nameMap" listKey="key" listValue="value" />
						</td>
						</tr>
						<tr>
						<td align="right">是否已出库</td>
						<td align="left" >
						<s:if test="#session.session_merchant.roleType==\"00\"||#session.session_merchant.roleType==\"01\"">
							<s:select name="searchCondition.isUsed" list="#{'N':'否','Y':'是'}" headerKey="99" headerValue="-不限---" cssClass="queryWidth" ></s:select>
						</s:if>
						<s:else>
						    <s:select name="searchCondition.isUsed" list="#{'Y':'是','N':'否'}"  cssClass="queryWidth" ></s:select>
					
						</s:else>
						</td>
						<td align="right" width="15%">终端序列号：</td>
						<td align="left" ><s:textfield id="serialNum" name="searchCondition.serialNum" cssClass="queryWidth" /></td>
						<td colspan="2"></td>
						</tr>
				<tr>
					<td colspan="6">&nbsp;</td>
				</tr>
				<tr>
					<td colspan="6" align="center">代理商基本信息：账号【<s:property value="#request.merchant.accountNo" />】，姓名【
					<s:property value="#request.merchant.realName" />】</td>
				</tr>
				<tr>
					<td colspan="6">&nbsp;</td>
				</tr>
				<tr>
					<td colspan="6" align="center">
					<s:submit value="查 询" id="sub" /> &nbsp;&nbsp;&nbsp;&nbsp; <s:reset value="取  消" />&nbsp;&nbsp;&nbsp;&nbsp;
					<s:if
					test="#request.searchRsList != null && #request.searchRsList.size>0">
						<s:submit id="revokeBtn"  value="撤  回" />
					</s:if>
					<s:else>
						<s:submit id="revokeBtn"  disabled="true" value="撤  回" />
					</s:else>
					
					&nbsp;&nbsp;&nbsp;&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="6">&nbsp;</td>
				</tr>
				<tr>
					<td colspan="6" align="center"><div style="color: red;">
							<s:actionmessage />
						</div>
						<div style="color: red;">
							<s:actionerror />
						</div></td>
				</tr>
				<tr>
					<td colspan="6">&nbsp;</td>
				</tr>
			</table>
 <table width="100%" cellpadding="0" cellspacing="0" border="0">
				<tr>
					<td colspan="6" align="center">
						<h2 class="headline-inquires">可撤回终端信息列表</h2>
					</td>
				</tr>
				<s:if
					test="#request.searchRsList != null && #request.searchRsList.size>0">
					<tr>
						<td align="left">&nbsp;&nbsp;&nbsp;&nbsp; <page:pageCount
								max_pages="11" totalPage="${requestScope.totalPage}"
								currentPage="${requestScope.currentPage}"
								action="${rootPath}/termAllotRecall/queryTermAllotInfo.ct?currentPage=" />
						</td>
					</tr>
				</s:if>
			</table>
		
			<table id="tableList" width="100%" class="table">
				<thead>
					<tr>
					    <th>选择</th>
					    <th>终端序列号</th>
					    <th>所属代理商</th>
					    <th>绑定状态</th>
						<th>终端名称</th>
						<th>品牌</th>
						<th>机型</th>
						<th>库存状态</th>
						<th>入库时间</th>
						<th>出库时间</th>
						<th>备注</th>
					</tr>
				</thead>
				<tbody>
					<s:iterator value="#request.searchRsList" status="stat" id="term">
							<tr class="<s:if test="#stat.index%2==0">tr_0</s:if>" >
							<td align="center">
								<s:if test="#session.session_merchant.roleType==\"02\"||#session.session_merchant.roleType==\"03\"">
								   <s:if test="#term.isUsed==\"Y\"">
								  	 <s:checkboxlist name="multi_sel_str" list="#{#term.serialNum:''}"  theme="simple" />
									</s:if>
									<s:else>
									 <s:checkboxlist disabled="true" name="multi_sel_str" list="#{#term.serialNum:''}"  theme="simple" />
									
									</s:else>
								
								</s:if>
								<s:else>
								   <s:checkboxlist name="multi_sel_str" list="#{#term.serialNum:''}"  theme="simple" />
								</s:else>
					        </td>
							<td>
							 <s:property value="#term.serialNum"/>
							</td>
							<td>
							 <s:property value="#term.agentName"/>
							</td>
							<td>
							<s:if test="#term.isBind==\"N\"">否</s:if>
							<s:else>是</s:else>
							</td>
							<td>
							 <s:property value="#term.posName"/>
							</td>
							<td>
							 <s:property value="#term.posBrand"/>
							</td>
							<td>
							 <s:property value="#term.posType"/>
							</td>
							<td>
							 
							 <s:if test="#term.isUsed==\"N\"">否</s:if>
							<s:else>是</s:else>
							</td>
							<td>
							 <s:property value="#term.dtCreate"/>
							</td>
							<td>
							 <s:property value="#term.dtLostmod"/>
							</td>
							<td>
							 <s:property value="#term.remark"/>
							</td>
							</tr>
						</s:iterator>
				</tbody>
			</table>
		</s:form>
	</div>
</body>
</html>